home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0" encoding="utf-8" ?>
- <!DOCTYPE stack PUBLIC "-//Apple, Inc.//DTD stack V 2.0//EN" "" >
- <stack>
- <name>in</name>
- <id>-1</id>
- <cardCount>2</cardCount>
- <cardID>3066</cardID>
- <listID>2143</listID>
- <cantModify><false /></cantModify>
- <cantDelete><false /></cantDelete>
- <cantAbort><false /></cantAbort>
- <cardSize>
- <width>512</width>
- <height>342</height>
- </cardSize>
- <script>on openStack
- set userLevel to 5 -- destructive
- hide msg
- hide menuBar
- hide card field 1
- hide card field 3
- hide card field 4
- hide card field 5
- hide card field 6
- hide card field 7
- init
- end openStack
-
- on macplay
- global macpieces,manpieces
- set cursor to 4
- put "o" into macxo
- put "x" into manxo
- put empty into macmove
- put card field 1 into temphold
- -- can mac win?
- if macpieces >=2 then
- repeat with li = 1 to 9
- put char 1 of line li of card field 2 into i
- put char 2 of line li of card field 2 into j
- if word i of line j of card field array is "e" then
- putarray macxo,i,j
- if not (winner() is empty) then put i&&j into macmove
- put temphold into card field array
- if not (macmove is empty) then exit repeat
- end if
- end repeat
- end if
- -- can man win on next move?
- if manpieces >= 2 then
- if macmove is empty then
- repeat with li = 1 to 9
- put char 1 of line li of card field 2 into i
- put char 2 of line li of card field 2 into j
- if word i of line j of card field array is "e" then
- putarray manxo,i,j
- if not (winner() is empty) then put i&&j into macmove
- put temphold into card field array
- if not (macmove is empty) then exit repeat
- end if
- end repeat
- end if
- end if
- -- pick randomly
- if macmove is empty then
- repeat with li = 1 to 9
- put char 1 of line li of card field 2 into i
- put char 2 of line li of card field 2 into j
- if word i of line j of card field array is "e" then
- put i&&j into macmove
- exit repeat
- end if
- end repeat
- end if
- -- restore board
- put temphold into card field 1
- if not (macmove is empty) then
- put word 1 of macmove into boxh
- put word 2 of macmove into boxv
- putarray macxo, boxh, boxv
- add 1 to macpieces
- dragit macxo,boxh,boxv
- if not (winner() is empty) then play boing "c4 g3 f3 b3 c3"
- end if
- end macplay
-
- -- plays x for man
- on manplay boxh,boxv
- global manpieces
- if not (winner() is empty) then
- beep 2
- exit manplay
- end if
- if word boxh of line boxv of card field array is "e" then
- put "x" into word boxh of line boxv of card field array
- add 1 to manpieces
- dragit x,boxh,boxv
- if winner() is not empty then
- play harpsichord "c d e f g a b c 4"
- else macplay
- else beep
- end manplay
-
- on putarray xo,boxh,boxv
- put xo into word boxh of line boxv of card field array
- end putarray
-
- on init
- global v0,v1,v2,h0,h1,h2,xloc,oloc,manpieces,macpieces
- put "e e e" & return & "e e e" & return & "e e e" into ¬
- card field array
- choose select tool
- set cursor to 4
- drag from 208,72 to 418,271
- doMenu "Trace edges"
- doMenu "Clear picture"
- choose browse tool
- set cursor to 4
-
- put 101 into v0
- put 171 into v1
- put 241 into v2
- put 243 into h0
- put 314 into h1
- put 384 into h2
- put "143,289" into xloc
- put "67,290" into oloc
-
- put 0 into macpieces
- put 0 into manpieces
-
- end init
-
- -- winner returns "(xo) (row/column/diagonal) (1/2/3)"
- function winner
- put empty into status
- repeat with i = 1 to 3
- -- check horizontal win
- if not (word 1 of line i of card field array is "e") and ¬
- word 1 of line i of card field array = ¬
- word 2 of line i of card field array and ¬
- word 1 of line i of card field array = ¬
- word 3 of line i of card field array then
- put word 1 of line i of card field array && ¬
- "row" && i into status
- end if
- -- check vertical win
- if not (word i of line 1 of card field array is "e") and ¬
- word i of line 1 of card field array = ¬
- word i of line 2 of card field array and ¬
- word i of line 1 of card field array = ¬
- word i of line 3 of card field array then
- put word i of line 1 of card field array && ¬
- "column" && i into status
- end if
- end repeat
- -- check diagonal win
- if not (word 1 of line 1 of card field array is "e") and ¬
- word 1 of line 1 of card field array = ¬
- word 2 of line 2 of card field array and ¬
- word 1 of line 1 of card field array = ¬
- word 3 of line 3 of card field array then
- put word 1 of line 1 of card field array && ¬
- "diagonal 1" into status
- end if
- if not (word 3 of line 1 of card field array is "e") and ¬
- word 3 of line 1 of card field array = ¬
- word 2 of line 2 of card field array and ¬
- word 1 of line 3 of card field array = ¬
- word 3 of line 1 of card field array then
- put word 3 of line 1 of card field array && ¬
- "diagonal 2" into status
- end if
- return status
- end winner
-
- -- dragit (x/o) (123) (123)
- on dragit
- global v0,v1,v2,h0,h1,h2,xloc,oloc
- set cursor to 4
- set dragSpeed to 400
- if param(1) is "x" then put xloc into thing
- else put oloc into thing
- if param(2) is 1 then put h0 into desth
- if param(2) is 2 then put h1 into desth
- if param(2) is 3 then put h2 into desth
- if param(3) is 1 then put v0 into destv
- if param(3) is 2 then put v1 into destv
- if param(3) is 3 then put v2 into destv
- set lockScreen to true
- push card
- go to card "template"
- choose lasso tool
- click at thing with commandKey
- doMenu "Copy picture"
- pop card
- doMenu "Paste picture"
- doMenu "Transparent"
- set lockScreen to false
- drag from thing to desth,destv
-
- choose browse tool
- end dragit
-
- </script>
- <background id="2594" file="background_2594.xml" name="" />
- <card id="3066" file="card_3066.xml" marked="false" name="playcard" owner="2594" />
- <card id="3187" file="card_3187.xml" marked="false" name="template" owner="2594" />
- </stack>
-